﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RssMenuList.ascx.cs" Inherits="admin_webparts_Plug_ins_RssNews_RssMenuList" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Import Namespace="NTTHAO.Web.BL.Rss" %>
<%
if (_Group != null) 
{
    string backUrl = "?type=" + Request.QueryString["type"] + "&name=" + Request.QueryString["name"] + "&item=" + Request.QueryString["item"];
    string bUrl = backUrl + "&g=" + Request.QueryString["g"];
    bool isAdmin = Context.User.Identity.Name.Equals("admin", StringComparison.OrdinalIgnoreCase);
    int langID = LanguageUtility.GetLanguageID();
    int siteID = WebGlobal.GetSite().ID;
%>
<script type="text/javascript">
    function confirmDelete() {
        var msg = '<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace(Environment.NewLine, "<br />")%>';
        return confirm(msg.replace(/<br \/>/gi, "\r\n").replace(/<br\/>/gi, "\r\n"));
    }
</script>
<div class="tip" style="position: relative;">
	<h1 style="left: 0px; position: relative;">Menu tin tức RSS</h1>
	<div style="display: block; width: 32px; height: 32px; float: right; position: absolute; top: 5px; right: 5px;"><a title="Click vào đây để quay lại." href="<%=backUrl %>"><img alt="Back" src="resources/images/Back.png" /></a></div>
</div>
<div style="border: solid 1px #89D; overflow: hidden;padding: 0px;">
    <div class="stairs oh">
        <div class="step b" style="border-left: none; border-bottom: dashed 1px #89D;">
            <p><%=_Group.Name %></p>
            <ul class="icon" style="width: 28px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("ADD_SUB_MENU", Session)%>" href="<%=bUrl+"&m=0" %>&action=addmenu" class="icon addfbtn">&nbsp</a></li>
            </ul>
        </div>
        <div class="stair"> <%
    try
    {
        RssGroupTree tree = RssPageGroup.GetTree(_Group.ID);
        RssMenuNode node = tree.Node;
        while (node != null)
        {
            if (node.Menu.ID > 0)
            {
                //print node here 
%>
            <div class="step">
                <p><%=node.Menu.Text %></p>
                <ul class="icon" style="width: 112px;">
                    <li><a title="<%=LanguageUtility.GetLanguageText("CONFIG", Session)%>" href="<%=bUrl+"&m=" + node.Menu.ID.ToString() %>&action=detail" class="icon configbtn">&nbsp</a></li>
                    <li><a title="<%=LanguageUtility.GetLanguageText("ADD_SUB_MENU", Session)%>" href="<%=bUrl+"&m=" + node.Menu.ID.ToString() %>&action=addmenu" class="icon addfbtn">&nbsp</a></li>
                    <li><a title="<%=LanguageUtility.GetLanguageText("EDIT", Session)%>" href="<%=bUrl+"&m=" + node.Menu.ID.ToString() %>&action=editmenu" class="icon editbn">&nbsp</a></li>
                    <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="<%=bUrl+"&m=" + node.Menu.ID.ToString() %>&action=removemenu" class="icon deletebn" onclick="javascript: return confirmDelete();">&nbsp;</a></li>
                </ul>
            </div> <%
            }

            if (node.Children != null)
            {
                if (node.Menu.ID > 0)
                {
                    // open children group here
%>
            <div class="step">
                <div class="stair"><%
                }
                node = node.Children[0];
            }
            else if (node.NextNode != null)
            {
                node = node.NextNode;
            }
            else
            {
                bool next = false;
                while (!next && node != null)
                {
                    if (node.Parent != null && node.Parent.Menu.ID > 0)
                    {
                        // close children group here
%>
                </div>
            </div> <%
                    }
                    node = node.Parent;
                    if (node != null && node.NextNode != null)
                    {
                        node = node.NextNode;
                        next = true;
                    }
                }
            }
        }
            
    }
    catch { }
%>
        </div>
    </div>
</div>
<%} %>